package util;

import java.io.IOException;
import java.io.InputStream;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;

public class SessionFactory {
	public static SqlSession SqlSessionFactory() throws IOException {
		String path = "Config.xml";
		InputStream stream = Resources.getResourceAsStream(path);
		SqlSessionFactoryBuilder builder = new SqlSessionFactoryBuilder();
		SqlSessionFactory factory = builder.build(stream);
		SqlSession session = factory.openSession();
		return session;
	}
}
